package com.afiorenza.two.runnable;

import java.util.concurrent.BlockingQueue;

import com.afiorenza.two.Generator;

public class Productor implements Runnable {
	private Generator generator;
	private long cantNumeros;
	private BlockingQueue<Long> queue;
	
	
	public Productor(long cantNumeros, BlockingQueue<Long> queue, Generator generator) {
		this.cantNumeros = cantNumeros;
		this.queue = queue;
		this.generator = generator;
	}

//	public Productor(Generator generator) {
//		this.generator = generator;
//	}

	@Override
	public void run() {
		for (long i = 0; i < cantNumeros; i++) {
			System.out.println("generando: " + generator.getClass() + " i " + i);
			queue.add(generator.next());
		}
		System.out.println("fin generacion: queue: " + queue);
	}

}